//
//  HKListCellModel.h
//  KSBridgeDesign
//
//  Created by huzhaoke on 2021/4/13.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "HKListCellModelContext.h"

@class HKListSectionModel;
NS_ASSUME_NONNULL_BEGIN

typedef void(^ReloadCompleteBlock)(BOOL isCompleted);

@interface HKListCellModel : NSObject

//当前cell的唯一标识 可以cellClass的string作为标识 如果想单独设定可以自己复写
@property (nonatomic, copy, readonly) NSString *identifier;
@property (nonatomic, strong, null_resettable) HKListCellModelContext *context;
//当前cell的class
@property (nonatomic, strong) Class cellClass;
//当前的高度
@property (nonatomic, assign) CGFloat cellHeight;
//当前的高度
@property (nonatomic, assign) CGFloat cellWidth;
//当前的内容
@property (nonatomic, strong) id content;
//当前的sectionModel
@property (nonatomic, weak) HKListSectionModel *sectionModel;

//是否禁止动画
@property (nonatomic, assign) BOOL disableCellAnimation;

//是否正在渲染中
@property (nonatomic, assign) BOOL isReloading;

//  Cell渲染，使用时注意循环引用问题
@property (nonatomic, copy) void (^render)(__kindof HKListCellModel *cellModel, id cell);

@property (nonatomic, copy) void(^cellWillDisplayBlock)(HKListCellModel *cellModel, NSIndexPath *indexPath, id cell);
@property (nonatomic, copy) void(^cellDidEndDisplayBlock)(HKListCellModel *cellModel, NSIndexPath *indexPath, id cell);

@property (nonatomic, copy) void(^cellDetachBlock)(HKListCellModel *cellModel, NSIndexPath *indexPath, id cell);

@property (nonatomic, copy) void (^cellDidSelectBlock)(HKListCellModel *cellModel, NSIndexPath *indexPath, id cell);

@property (nonatomic, copy) void (^cellDidHighlightBlock)(HKListCellModel *cellModel, NSIndexPath *indexPath, id cell);
@property (nonatomic, copy) void (^cellDidUnhighlightBlock)(HKListCellModel *cellModel, NSIndexPath *indexPath, id cell);

@property (nonatomic, copy, nullable) CGFloat (^cellWidthBlock)(void);

- (NSIndexPath *)cellIndexPath;
- (void)reload;
- (void)reloadWithAnimation:(UITableViewRowAnimation)animation;
- (void)reloadWithAnimation:(UITableViewRowAnimation)animation completion:(void (^ _Nullable)(BOOL finished))completion;

@end

NS_ASSUME_NONNULL_END

